package com.zichuan.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @author zichuan
 * @version 1.0
 * @Package : com.zichuan.config
 * @Description : TODO
 * @Create on : 2025/2/18 15:15
 */
@Slf4j
@Component
public class MyConfirmCallBack implements RabbitTemplate.ConfirmCallback {

    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        String id = correlationData.getId();
        if (ack){
            //消息正确到达交换机
            log.info("消息正确到达交换机");
            return;
        }
        log.error("消息没有到达交换机，原因为:{}",cause);
    }
}
